"use strict";
const common_vendor = require("../../common/vendor.js");
const api_vido = require("../../api/vido.js");
const utils_message = require("../../utils/message.js");
require("../../utils/request.js");
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const videoList = common_vendor.ref([]);
    const videoGroupList = common_vendor.ref([]);
    const getNavListAll = async () => {
      try {
        let result = await api_vido.vidoApi.reqNavListAll();
        if (result.code === 200) {
          videoList.value = result.data;
          let id = result.data[0].id;
          getVideoList(id);
        }
      } catch (error) {
        console.log(error);
        utils_message.showToast("获取数据失败", "error");
      }
    };
    const getVideoList = async (id) => {
      try {
        let result = await api_vido.vidoApi.reqVideoList(id);
        if (result.code === 200) {
          videoGroupList.value = result.datas;
        }
      } catch (error) {
        console.log(error);
        utils_message.showToast("获取视频资源失败", "error");
      }
    };
    const changNav = (id) => {
      getVideoList(id);
    };
    common_vendor.onLoad(() => {
      getNavListAll();
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(videoList.value, (item, index, i0) => {
          return common_vendor.e({
            a: index < 14
          }, index < 14 ? {
            b: common_vendor.t(item.name),
            c: common_vendor.o(($event) => changNav(item.id), item.id)
          } : {}, {
            d: item.id
          });
        }),
        b: common_vendor.f(videoGroupList.value, (item, k0, i0) => {
          return {
            a: item.data.coverUrl,
            b: item.data.urlInfo.url,
            c: common_vendor.t(item.data.title),
            d: item.data.creator.avatarUrl,
            e: common_vendor.t(item.data.creator.nickname),
            f: common_vendor.t(item.data.praisedCount),
            g: common_vendor.t(item.data.commentCount),
            h: item.id
          };
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-aaf343fc"], ["__file", "D:/Desktop/cloud_yy/src/pages/video/index.vue"]]);
wx.createPage(MiniProgramPage);
